<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $uid 
 * @property int $main_uid 
 * @property array $robot_ids 需要检测的机器人ID
 * @property int $status 
 * @property array $user_ids 重复客户的ID
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 */
class ChContactDedupTask extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_contact_dedup_task';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uid', 'main_uid', 'robot_ids', 'status', 'user_ids', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'main_uid' => 'integer', 'robot_ids' => 'array', 'status' => 'integer', 'user_ids' => 'array', 'created_at' => 'datetime', 'updated_at' => 'datetime'];


    public function robots(): \Hyperf\Database\Model\Relations\BelongsToMany
    {
        return $this->belongsToMany(ChRobot::class,'ch_contact_dedup_task_robot','task_id','robot_id')->withPivot('sort');
    }
}
